package com.zyz.handler;

import com.zyz.domain.User;

public class UserHolder {

    //创建一个ThreadLocal对象
    private static ThreadLocal<User> th = new ThreadLocal();


    //放入
    public static void set(User user) {
        th.set(user);
    }

    //获取
    public static User get() {
        return th.get();
    }

    //移除
    public static void remove() {
        th.remove();
    }

    public static void setUser(User user) {
        th.set(user);
    }
}
